using System;
using System.Collections.Generic;
using System.Text;
using ORMapping;
using NHibernate;
namespace DAL
{
    public class TBLCardTypeDAL
    {
        private EntityControl<TBLCardType> control;

        public TBLCardTypeDAL()
        {
            control = EntityControl<TBLCardType>.CreateEntityControl("ORMapping");
        }

        public void AddCardType(TBLCardType cardtype)
        {
            control.AddEntity(cardtype);
        }

        public long CardTypeCount()
        {
            return control.Count();
        }

        public IList<TBLCardType> GetAllCardTypes(string strHQL, System.Collections.Generic.List<HQLParameter> hp)
        {
            return control.GetEntities(strHQL, hp);
        }

        public IList<TBLCardType> GetAllRow()
        {
            return control.ALLRow();
        }

        public TBLCardType GetCardType(TBLCardType tct)
        {
            string strHQL = "from TBLCardType c where c.CardType = :CardType";
            System.Collections.Generic.List<HQLParameter> hp = new System.Collections.Generic.List<HQLParameter>(1);
            hp.Add(new HQLParameter(EnumHQLParameterType.STRING, "CardType", tct.CardType));
            IList<TBLCardType> lc = control.GetEntities(strHQL, hp);
            return lc.Count > 0 ? lc[0] : null;
        }

    }
}
